import type { App } from "vue"
import type { SFCWithInstall } from "./typescript"

export const withInstall = <T>(component: T) => {
  ;(component as SFCWithInstall<T>).install = (app: App) => {
    const name = "Pc" + (component as any).name
    app.component(name, component as SFCWithInstall<T>)
  }

  return component as SFCWithInstall<T>
}
